package com.ymatou.iapi.fastturnover.service;

import org.json.JSONObject;

import com.ymt.base.YmatouBaseCall;
import com.ymttest.utils.EnvSetup;

public class FastTurnoverWithdrawApplyCall extends YmatouBaseCall {
	
	private static String opurl = "/api/fastTurnoverWithdrawApply";

	public FastTurnoverWithdrawApplyCall() {
		super(EnvSetup.getSystemUrl("fastturnover_iapi"), opurl, "POST",
				"JSON");
	}

	@Override
	public void addDefHeader() {
		client.addHeader("Accept",
				"text/xml,text/javascript,text/html,application/json");
		client.addHeader("Content-Type", "application/json; charset=UTF-8");
	}

	public int getRetultCode() {

		int resultCode = 0;
		
		try {
			resultCode = new JSONObject(getReturnData()).getInt("code");
		} catch (Exception e) {
			e.printStackTrace();
		}
		
		return resultCode;
	}

	public boolean isSuccess() {
		
		boolean success = false;
		
		try {
			success = new JSONObject(getReturnData()).getBoolean("success");
		} catch (Exception e) {
			e.printStackTrace();
		}
		
		return success;
	}
	
	public String getMsg() {
		
		String msg = "";
		
		try {
			msg = new JSONObject(getReturnData()).getString("msg");
		} catch (Exception e) {
			e.printStackTrace();
		}
		
		return msg;
	}

	public Double getResult() {
		
		Double result = null;
		
		try {
			result = new JSONObject(getReturnData()).getDouble("result");
		} catch (Exception e) {
			e.printStackTrace();
		}

		return result;
	}
}
